<!DOCTYPE html>
<html lang="en">
<head>
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta charset="UTF-8">
    <title>登记新图书界面</title>
    <!-- 最新版本的 Bootstrap 核心 CSS 文件 -->
    <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/3.4.1/css/bootstrap.min.css"
          integrity="sha384-HSMxcRTRxnN+Bdg0JdbxYKrThecOKuH5zCYotlSAcp1+c8xmyTe9GYg1l9a69psu" 
          crossorigin="anonymous">
    <!-- 最新的 Bootstrap 核心 JavaScript 文件 -->
    <script src="https://stackpath.bootstrapcdn.com/bootstrap/3.4.1/js/bootstrap.min.js"
            integrity="sha384-aJ21OjlMXNL5UyIl/XNwTMqvzeRMZH2w8c5cRVpzpU8Y5bApTppSuUkhZXN0VxHd"
            crossorigin="anonymous"></script>
</head>
<body>
<form>
    <div class="form-group">
        <label for="bookname">图书名称</label>
        <input type="text" class="form-control" id="bookname" placeholder="请输入图书名称">
    </div>
    <div class="form-group">
        <label for="author">作者</label>
        <input type="text" class="form-control" id="author" placeholder="请输入作者">
    </div>
    <div class="form-group">
        <label for="publisher">出版社</label>
        <input type="text" class="form-control" id="publisher" placeholder="请输入出版社">
    </div>
    <div class="form-group">
        <label for="year">出版年份</label>
        <select class="form-control" id="year">
            <option>2021</option>
            <option>2020</option>
            <option>2019</option>
            <option>2018</option>
            <option>2017</option>
        </select>
    </div>
    <div class="form-group">
        <label for="publisher">库存数量</label>
        <input type="text" class="form-control" id="nums" placeholder="请输入库存数量">
    </div>
    <div class="form-group">
        <label for="exampleInputFile">选择图书封面文件</label>
        <input type="file" id="exampleInputFile">
    </div>

</form>
<button  class="btn btn-default" onclick="fn()">Submit</button>
<script>
    let btn=document.querySelector(".btn")
    var bookname = document.getElementById("bookname")[0].value
    console.log(document.getElementById('bookname').value);
    var name = bookname.innerHTML
    function fn(){
        // if(XO.innerHTML!="")
        // alert(name)
        confirm(bookname)
    }
</script>
</body>
</html>